package plataforma.base.cgd;

import java.util.List;

import plataforma.base.cdp.Criterio;

public class HelperCriteria {

	public static String toJpql(List<Criterio> criterionEntries) {

		StringBuilder sb = new StringBuilder();

		if (!criterionEntries.isEmpty()) {

			int size = criterionEntries.size();

			for (int i = 0; i < size; i++) {

				sb.append(criterionEntries.get(i));

				if (i != (size - 1)) {

					sb.append(" AND ");

				}

			}

			sb.insert(0, " WHERE ");

		}

		return sb.toString();

	}

}
